local skel = fk.CreateSkill {
  name = "lb__weiling",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable {
  ["lb__weiling"] = "尾灵",
  [":lb__weiling"] = "<b>锁定技</b>，当你获得此技能时，你进行判定；当你失去此技能时，你展示手牌并重铸所有伤害牌。",

  ["$lb__weiling1"] = "藿藿：非、非得战斗吗？尾巴：对喽~别逃啊~",
  ["$lb__weiling2"] = "尾巴：有老子在，你怕什么？",
  ["$lb__weiling3"] = "呜好疼…",
  ["$lb__weiling4"] = "这下肯定做不到了…",
}

skel:addEffect("prohibit", {})

skel:addAcquireEffect(function(self, player, is_start)
  player.room:notifySkillInvoked(player, skel.name, "defensive")
  player:broadcastSkillInvoke(skel.name, math.random(1, 2))
  local judge = {
    who = player,
    reason = "lb__weiling",
    pattern = ".",
  }
  player.room:judge(judge)
end)

skel:addLoseEffect(function(self, player, is_death)
  player.room:notifySkillInvoked(player, skel.name, "drawcard")
  player:broadcastSkillInvoke(skel.name, math.random(3, 4))
  local cards = player:getCardIds("h")
  if #cards > 0 then
    player:showCards(cards)
    player.room:delay(math.min(#cards, 9) * 150)
    cards = table.filter(cards, function(id)
      return Fk:getCardById(id).is_damage_card
    end)
    if #cards > 0 then
      player.room:recastCard(cards, player, skel.name)
    end
  end
end)

return skel
